<template>
  <nav class="fixed-top" :class="style.navbar">
    <a class="navbar-brand" href="#">{{$store.state.title}}</a>
    <!-- <span class="navbar-text">{{info_rate}}</span> -->
  </nav>
</template>

<script>
export default {
  name: "Header",
  data() {
    return {
      title: "练习题"
    };
  },
  computed: {
    style() {
      return this.$store.state.style;
    },
    info_rate() {
      let rate = 0;
      let right = 0;
      if (this.$store.state.content) {
        for (let i = 0; i < this.$store.state.recorder.length; i++) {
          if (this.$store.state.recorder[i].isRight) {
            right++;
          }
        }
        rate = right / this.$store.state.content.length;
      }

      return "正确率" + rate * 100 + "%";
    }
  }
};
</script>

